<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<title>商品列表</title>
<%@ include file="../../../common/admin_taglib.jsp" %>
<link rel="stylesheet" type="text/css" href="${ctx}/resources/js/jquery-easyui-1.3.3/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="${ctx}/resources/js/jquery-easyui-1.3.3/themes/icon.css">
<script type="text/javascript" src="${ctx}/resources/js/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
$(function(){
	$("#deleteConfirm_ok").click(function(){
		if (goodId > 0)
			location.href = "${ctx}/admin/goods/delete/" + goodId;
	});
});
function updateNBH(type, goodId, flag) {
	$.get('${ctx}/admin/goods/list/updatenbh?type=' + type + '&goodId=' + goodId + '&flag=' + flag);
}
var goodId = 0;
function deleteGood(gid) {
	goodId = gid;
	$("#deleteConfirm").modal("show");
}
</script>
</head>
<body>

<dd:messager id="deleteConfirm" type="confirm" content="你确认要删除吗？删除后你可以在回收站中恢复。"></dd:messager>

<h1 class="page-title">Shop4j 管理中心</h1>
<ul class="breadcrumb">
	 <li><a href="${ctx}/admin/main">管理中心</a><span class="divider">/</span></li>
     <li class="active">商品列表</li>
</ul>

<div class="row-fluid">
	<div class="btn-toolbar">
	    <a class="btn btn-primary" href="${ctx}/admin/goods/insert"><i class="icon-plus"></i>添加商品</a>
	    <a class="btn" href="${ctx}/admin/goods/export">导出</a>
	  	<div class="btn-group"></div>
	</div>
	
	<div class="block">
		<div class="block-heading">
            <span class="block-icon pull-right">
                <a href="#widget2container" data-toggle="collapse">
                	<i class="icon-chevron-down"></i>
                </a>
            </span>
            <a>商品查询</a>
        </div>
        <div id="widget2container" class="block-body collapse in">
	        <form:form id="search_form" cssClass="form-horizontal" method="post" commandName="query">
	        	<table width="100%">
	        		<tr>
	        			<td>商品名称</td>
	        			<td>
	        				<form:input path="name" cssClass="input-xlarge" placeholder="请输入文字..."/>
	        			</td>
	        			<td>货号</td>
	        			<td>
	        				<form:input path="code" cssClass="input-xlarge" placeholder="请输入文字..."/>
	        			</td>
	        		</tr>
	        		<tr>
	        			<td>售价</td>
	        			<td>
	        				<div class="input-prepend input-append">
		        				<span class="add-on">$</span>
		        				<form:input path="shopPriceBegin" cssClass="input-small easyui-numberbox" placeholder="请输入文字..."/>
		        				<span class="add-on">.00</span>
	        				</div>
	        				~
	        				<div class="input-prepend input-append">
		        				<span class="add-on">$</span>
		        				<form:input path="shopPriceEnd" cssClass="input-small easyui-numberbox" placeholder="请输入文字..."/>
		        				<span class="add-on">.00</span>
	        				</div>
	        			</td>
	        			<td>状态</td>
	        			<td>
	        				<form:select path="status" cssClass="span6">
	        					<form:option value="">-请选择-</form:option>
	        				</form:select>
	        			</td>
	        		</tr>
	        		<tr>
	        			<td>新精热状态</td>
	        			<td colspan="2">
			        		<label class="checkbox_label">
		        				<form:checkbox path="newFlag"/>
		        				新品
		        			</label>
		        			<label class="checkbox_label">
		        				<form:checkbox path="bestFlag"/>
		        				精品
		        			</label>
		        			<label class="checkbox_label">
		        				<form:checkbox path="hotFlag"/>
		        				热销
		        			</label>	
	        			</td>
	        			<td align="right">
	        				<button type="submit" class="btn btn-info">
	        					<i class="icon-search"></i>
	        					搜索
	        				</button>
	        			</td>
	        		</tr>
	        	</table>
            </form:form>
        </div>
    </div>
	
	<div class="well">
		<table class="table">
			<thead>
		    	<tr>
		    		<td>#编号</td>
		    		<td>商品名称</td>
		    		<td>货号</td>
		    		<td>售价</td>
		    		<td>状态</td>
		    		<td>新品</td>
		    		<td>精品</td>
		    		<td>热销</td>
		    		<td>库存</td>
		    		<td>操作</td>
		        </tr>
		     </thead>
		     <tbody>
		     	<c:forEach items="${page.entities}" var="g">
		     	<tr>
		     		<td>${g.id}</td>
		     		<td><label style="${g.nameStyle}">${g.name}</label></td>
		     		<td>${g.code}</td>
		     		<td>${g.shopPrice}</td>
		     		<td>${g.status}</td>
		     		<td align="center"><input onclick="$.get('${ctx}/admin/goods/list/updatenbh?type=new&goodId=${g.id}&flag='+this.checked);" type="checkbox" ${g.newFlag ? "checked='checked'" : ""} /></td>
		     		<td align="center"><input onclick="$.get('${ctx}/admin/goods/list/updatenbh?type=best&goodId=${g.id}&flag='+this.checked);" type="checkbox" ${g.bestFlag ? "checked='checked'" : ""} /></td>
		     		<td align="center"><input onclick="$.get('${ctx}/admin/goods/list/updatenbh?type=hot&goodId=${g.id}&flag='+this.checked);" type="checkbox" ${g.hotFlag ? "checked='checked'" : ""} /></td>
		     		<td>${g.goodNum}</td>
		     		<td>
		     			<a href="javascript:deleteGood(${g.id});">删除</a>
		     			<a href="${ctx}/admin/goods/update/${g.id}">编辑</a>
		     		</td>
		     	</tr>
		     	</c:forEach>
		     </tbody>
		</table>
	</div>
	<dd:pagination formId="search_form" count="${page.count }" page="${page.page }" curpage="${page.curpage }"></dd:pagination>
</div>
</body>
</html>
